﻿using Eagles.Application.Model.Enums;
using System;
using System.Collections.Generic;
using System.Data;
namespace Eagles.Base
{
    public class TransactionException : Exception
    {
        public string ErrorMessage { get; set; }

        public string ErrorCode { get; set; }


        public static Dictionary<string, string> ErrorInfo = new Dictionary<string, string>()
        {
         {"M01","未查询到符合条件的信息"} ,
         {"M02","当前群组下存在用户，无法删除！"  },
         {"M03","数据异常"},
         {"M04","用户名或密码错误"},
         {"M05","手机号码已存在"},
         {"M06","当前登录账号已经被锁定，请稍后重试"},
         {"M07","用户手机号码格式错误，请确认"},
         {"M08","对不起，当前您没有该功能权限。"},
         {"M09","未查询到符合条件的会议，请重试尝试添加。"},
         {"M10","参数错误"},
         {"M11","登录已过期，请重新登录"},
         {"M12","导入数据异常"},
         {"M13","数据异常，请确认当前会议是否正常"},
         {"M14","当前用户非系统内部用户"},
         {"M15","当前试卷已经关联到新闻/活动，请确认后删除"},
         //{"M16","新闻信息"},
         {"M17","当前积分配置已存在，请勿重复添加"},
         {"M18","当前操作员账号已存在，请勿重复添加"},
         {"M19","当前党员已存在，请核实后在操作"},
         {"M20","当前组织下已存在支部信息，无法删除，请删除支部后在进行操作"},
         {"M21","用户登录信息校验失败，请重新登录"},
         //{"M22","未查询到符合条件的会议，请重试尝试添加"},
         {"M99","系统开小差了，请联系管理员"},
        };

        public TransactionException(string errorCode, string errorMessage)
        {
            this.ErrorCode = errorCode;
            this.ErrorMessage = errorMessage;
        }


        public TransactionException(string errorCode)
        {

            this.ErrorCode = errorCode;
            this.ErrorMessage = ErrorInfo[errorCode];
        }
    }
}
